#ifndef __SPHDATA_HPP
#define __SPHDATA_HPP

#include <math.h>

#include <fstream>
#include <string>
#include <vector>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <algorithm>

#include "utils.hpp"

class SphData{
public:
    std::vector<std::string> dnames;
    std::map<std::string, int> map_names;
    std::vector<std::vector<double> > dvalues;
    std::vector<int> dkeys;
    
    double yUp, yDown, xLeft, xRight;

    double burnLeft, burnRight;

    double timeGet, timeRead;
public:
    double tdata;
public:    
    SphData();
    
    void clear();
    void readFile(std::string s);
    void readFileCompare(std::string s);
    
    std::vector<double> getData(std::string name);

    double derivate(std::vector<double> & tt, std::vector<double> & xx, std::vector<double> & xt);

    double detectLeft(std::vector<double> & xx, std::vector<double> & yy);
    double detectRight(std::vector<double> & xx, std::vector<double> & yy);

    double detectPeak(std::vector<double> & xx, std::vector<double> & yy);

    void smoothData(std::vector<double> & xx, std::vector<double> & vv);
    double detectFront(std::vector<double> & xx, std::vector<double> & yy);
};

#endif
